program myelg
  use mod_params
  use mod_myelg
  implicit none
  
 include 'mpif.h'
 
  integer :: ii, jj, ll, ss
  double precision :: val1,val2, z
  type(t_params) :: params
 

  
  call myelg_initialize()

!  open(unit=10,file='xi.dat',action='write',status='replace')
!  do i=1, 100
!     x = float(i)/100.0
   !  d = myelg_D(x)
!     write(10,*) log(x),d
!  end do
!  close(10)


!  call myelg_test_powerspectrum()

  params%params(1) = 0.3
  params%params(2) = 0.01
  params%params(3) = -1
  params%params(4) = 0.01
  params%params(5) = 1.0

!  call elglike_initialize(elglike, global_lmax)

  open(unit=10,file='shear1.dat',action='write',status='replace')
  open(unit=11,file='shear2.dat',action='write',status='replace')

  write(*,*) params%params
  val1 = 0

!  call test_lingrow()
!  stop

  do ss=1, 10
     ll = ss*10.d0
     params%params(6) = ll
     ii = 2.d0
     jj = 3.d0
     call shearpower(params%params(1:5), ii, jj, params%params(6), val1)


     !write(*,*) "myG", myelg_g(3,0.5d0)
     !x = x*1E8
     val2 = myelg_calculate_shear(ii,jj,ll)
     


     write(10, *) ll, val1
     write(11, *) ll, val2
     write(*,*) ll,val1, val2
     !z = ss / 10.0
     !call chi(params%params(1),params%params(3),params%params(4),z)
     !write(*,*) "mine", z, myelg_xi(z)
  end do
  close(11)
  close(10)


  stop

end program myelg



subroutine myelg_doall

  

  
end subroutine myelg_doall

